package com.web.ShoppingDemo.serviceImpl;

import java.math.BigDecimal;

import org.springframework.stereotype.Service;

import com.web.ShoppingDemo.model.Forder;
import com.web.ShoppingDemo.model.Sorder;
import com.web.ShoppingDemo.service.ForderService;

@Service("forderService")
public class ForderServiceImpl extends BaseServiceImpl<Forder> implements ForderService{

	@Override
	public BigDecimal cluTotal(Forder forder) {
		BigDecimal total = new BigDecimal(0.00);
		for(Sorder sorder:forder.getSorderList()){
			total = total.add(sorder.getPrice().multiply(new BigDecimal(sorder.getNumber())));
		}
		return total;
	}

	@Override
	public void updateStatusById(int id, int sid) {
		forderDao.updateStatusById(id, sid);
	}
	
}
